package com.my.ddd_sample_collections.aggregate_change_tracking.domain;

import com.my.ddd_sample_collections.aggregate_change_tracking.abstract_domain.AbstractItemDO;
import com.my.ddd_sample_collections.aggregate_change_tracking.abstract_domain.AbstractMyAggregateDO;
import com.my.ddd_sample_collections.aggregate_change_tracking.abstract_domain.MyArrayList;
import lombok.experimental.SuperBuilder;

@SuperBuilder
public class MyAggregateDO extends AbstractMyAggregateDO {
    
    private String myExtendedProperty;
    
    public void bussinessMethod_RemoveItem_1(){
        MyArrayList<AbstractItemDO> items = getItems();
        //TODO 怎么跟踪这种变化？ 通过自定义的 MyArrayList 实现
        items.remove(1);
        
        //这种没问题，就是新增
        items.add(ItemDO.builder().seq(2).name("name").build());
        
    }

}
